package com.hyz.util;

import com.hyz.pojo.response.AssetMaintenanceResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import pojo.ResponseResult;
import pojo.asset.assetMaintenance.AssetMaintenance;

import java.util.List;

/**
 * @author HGD
 * @date 2022/10/11 14:42
 */
@Component
public class AssetMaintenanceUtils {
    @Autowired
    private Conversion conversion;

    public ResponseResult<List<AssetMaintenanceResponse>> getAssetMaintenance(ResponseResult<List<AssetMaintenance>> result) {
        int code = 200;
        if (result.getStatus() != code) {
            return new ResponseResult<>(result.getStatus(), result.getMsg());
        }
        List<AssetMaintenanceResponse> responses = conversion.getAssetMaintenanceResponse(result.getData());
        return new ResponseResult<>(result.getStatus(), result.getMsg(), responses);
    }
}
